<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title><if condition="$isemp gt 0">尊敬的员工：{$nickname}<else/>员工：{$nickname}签到签退情况</if></title>
		<meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=0">
		<meta content="yes" name="apple-mobile-web-app-capable">
		<link rel="stylesheet" href="/newstatic/css/project.css" />
		<script src="__PERSON__/js/jquery.min.js"></script>
		<script src="__PERSON__/js/zui.min.js"></script>
	</head>
	<body>
		<div style="position:absolute;z-index:2000;left:30%;top:35%;display:none;" id="loading">
		<img src="/static/timg.gif" style="opacity:0.4;filter:alpha(opacity=40);"/>
		</div>
		<div style="position:absolute;z-index:2000;left:30%;top:35%;display:none;font-size:6vw;color:red;background:#ff9933;width:50%;text-align:center;padding-top:30px;padding-bottom:30px;border-radius:20px 20px;" id="loading1">
		</div>	
		<header>
			<div class="header center">
				<img src="/newstatic/img/logo.png" />
				<p>鑫诺洁家庭服务有限公司</p>
			</div>
		</header>
		<nav>
			<div class="nav1 active">
				<i class="iconfont">&#xe660;</i>
				<p>签到签退</p>
			</div>
		</nav>
		<div class="part1_top">
			<img src="/newstatic/img/tou.jpg" />
			<p>{$nickname}</p>
			<p>美好的一天，从家居清洁开始</p>
		</div>
		<article class="part1 detail_one" id="tabContent3">
			<div>
				<?php if($isemp>0) { ?>
				<p><if condition="$ord_info['contact'] neq ''">{$ord_info['contact']}<else/>{$ord_info['weixin_name']}</if></p>
				<p>{$ord_info['address']}</p>
				<p>服务时间：{$ord_info['pbb_date_format']}</p>
				<p class="dsign" data= "1">签到时间：<if condition="$ord_info['signintime'] gt 0">{$ord_info['signintime']|date='Y-m-d H:i:s',###}<else/>待签到</if></p>
				<p class="dsign" data= "2">签退时间：<if condition="$ord_info['signouttime'] gt 0">{$ord_info['signouttime']|date='Y-m-d H:i:s',###}<else/>待签退</if></p>
			</div>
			<?php  } else { ?>
				
				<p><if condition="$ord_info['contact'] neq ''">{$ord_info['contact']}<else/>{$ord_info['weixin_name']}</if></p>
				<p>{$ord_info['address']}</p>
				<p>服务时间：{$ord_info['pbb_date_format']}</p>
				<p class="dsign" data= "1">签到时间：<if condition="$ord_info['signintime'] gt 0">{$ord_info['signintime']|date='Y-m-d H:i:s',###}<else/>待签到</if></p>
				<p class="dsign" data= "2">签退时间：<if condition="$ord_info['signouttime'] gt 0">{$ord_info['signouttime']|date='Y-m-d H:i:s',###}<else/>待签退</if></p>
				<if condition="$signtype eq 2 and $ord_info['photosignout'] neq ''">
				<p><img src="http://ozmy75p4d.bkt.clouddn.com/{$ord_info['photosignout']}.jpg?t=<?php echo rand(1,11111);?>" style="width:36.0vw;height:46.0vw;" id="photobox"/></p>
				<elseif condition="$signtype eq 1 and $ord_info['photosignin'] neq ''"/>
				<p><img src="http://ozmy75p4d.bkt.clouddn.com/{$ord_info['photosignin']}.jpg?t=<?php echo rand(1,11111);?>" style="width:36.0vw;height:46.0vw;" id="photobox"/></p>
				<else/>
				<p><img src="/nopic.png" style="width:36.0vw;height:46.0vw;" id="photobox"/></p>
				</if>
			</div>
				<?php }?>
				<?php if($isemp>0){ ?>
				<div class="sd-btn">
								<if condition="$signtype eq 2 and $ord_info['issign'] gt 1">
								<a href="#" class="sdbtn-signOut">已签退</a>
								<elseif condition="$signtype eq 2 and $ord_info['issign'] eq 1"/>
								<a href="#" class="sdbtn-signOut sign" data="{$signtype}">签退</a>
								<elseif condition="$signtype eq 1 and $ord_info['issign'] gt 1"/>
								<a href="#" class="sdbtn-signOut">已签到</a>
								<elseif condition="$signtype eq 1 and $ord_info['issign'] eq 1"/>
								<a href="#" class="sdbtn-signOut sign" data="{$signtype}">签到</a>
								</if>
							</div>
				<?php }?>
				<?php if($isemp>0){ ?>
			<div class="pic_fill"  id="container">
				<a href="" class="pic" id="pickfiles"><i class="iconfont align">&#xe708;</i></a>
				<p class="pic_up">上传照片</p>
				<div class="photoupload">
					<if condition="$signtype eq 2 and $ord_info['photosignout'] neq ''">
					<a href="#" class="picbox"><img src="http://ozmy75p4d.bkt.clouddn.com/{$ord_info['photosignout']}.jpg" style="width:35.0vw;height:45.0vw;" id="photobox"/></a>
					<elseif condition="$signtype eq 1 and $ord_info['photosignin'] neq ''"/>
					<a href="#" class="picbox"><img src="http://ozmy75p4d.bkt.clouddn.com/{$ord_info['photosignin']}.jpg" style="width:35.0vw;height:45.0vw;" id="photobox"/></a>
					<else/>
					<a href="#" class="picbox"><img src="/nopic.png" style="width:35.0vw;height:45.0vw;" id="photobox"/></a>
					</if>
							<!--<input type="file" accept="image/gif,image/png,image/jpg,image/jpeg" class="img-upload"/>-->
				</div>
			<?php }?>
			<br/>
					<br/>
					<br/>
					<br/>	
					<input type="hidden" id="uid" value="{$ord_info['id']}X{$signtype}">
					<input type="hidden" id="pbb_id" value="{$ord_info['id']}">
					<input type="hidden" id="signtype" value="{$signtype}">
					<input type="hidden" id="uptoken_url" value="/up/token/upload_token.php">
		</article>
		
	</body>
	<script src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
		 <script type="text/javascript">

		 <if condition="$signtype eq 2 and $ord_info['photosignout'] neq ''">
		   var imgUrl = "http://ozmy75p4d.bkt.clouddn.com/{$ord_info['photosignout']}.jpg?t=<?php echo rand(1,11111);?>"; // 分享后展示的一张图片
		<elseif condition="$signtype eq 1 and $ord_info['photosignin'] neq ''"/>
			var imgUrl = "http://ozmy75p4d.bkt.clouddn.com/{$ord_info['photosignin']}.jpg?t=<?php echo rand(1,11111);?>";
			<else/>
		var imgUrl = "http://{$host}/logo.png";
		</if>
		
		var linelink = 'http://{$host}/welfarestaffsign?signtype=1&id={$ord_info['id']}'; // 点击分享后跳转的页面地址
		var descContent = "{$nickname}{$ord_info['pbb_date_format']}{$ord_info['address']}签到签退"; // 分享后的描述信息
		var shareTitle = '鑫诺洁生活：{$nickname}   出勤分享'; // 分享后的标题
		var appid = 'wx47352ed60c5ae845'; // 应用id,如果有可以填，没有就留空
		  wx.config({
				debug: false,
				appId: '{$r['appId']}',
				timestamp: '{$r['timestamp']}',
				nonceStr: '{$r['nonceStr']}',
				signature: '{$r['signature']}',
				jsApiList: [
				'chooseImage',
				'uploadImage',
				'onMenuShareTimeline',
				'onMenuShareAppMessage',
				'onMenuShareQQ',
				'onMenuShareWeibo',
				'onMenuShareQZone'
				]
			  });
			   wx.ready(function() { 
					wx.onMenuShareTimeline({ 
						title: shareTitle, // 分享标题 
						link: linelink, // 分享链接 
						imgUrl: imgUrl, // 分享图标 
						desc:descContent,
						success: function() { 
							// 用户确认分享后执行的回调函数 
						}, 
						cancel: function() { 
							// 用户取消分享后执行的回调函数 
						} 
					}); 
					wx.onMenuShareAppMessage({ 
						title: shareTitle, // 分享标题 
						link: linelink, // 分享链接 
						imgUrl: imgUrl, // 分享图标 
						desc:descContent,
						success: function() { 
							// 用户确认分享后执行的回调函数 
						}, 
						cancel: function() { 
							// 用户取消分享后执行的回调函数 
						} 
					}); 
    }); 
		 </script>
		<script type="text/javascript">
			var od={$ord_info['orders_id']|default=0};
			var emp_id={$ord_info['emp_id']};
			var id={$ord_info['id']};
			var issign={$ord_info['issign']|default=0};
			$(document).ready(
				function (e){
					
					$(".dsign").click(
					function (e){
						window.location.href="/welfarestaffsign?id="+id+"&signtype="+$(this).attr('data');
					}
				);
					$(".sd-btn").on('click','.sign',function (e){
						
						var signtype=$(this).attr('data');						
						$.ajax({
											type:'post',
											url:'/sign',
											dataType:'json',
											data:{id:id,signtype:signtype},
											success:function (d){
													if(d['status']>0){
														window.location.reload();
													}else{
														alert(d['info']);
													}
											}
										}
										);
						
						
					});
				$("#pickfiles").click(
					function(e){
						if(issign>0&&issign<2){
							<if condition="$signtype gt 1">
							alert('未签退,请点击上面签退按钮签退');
							<else/>
							alert('未签到,请点击上面签到按钮签到');
							</if>
							return false;
						}else if(issign<0){
							alert('不在时间范围内');
							return false;
						}
						<if condition="$signtype eq 2 and $ord_info['photosignout'] neq ''">
						alert('已经上传过照片');
						return false;
						<elseif condition="$signtype eq 1 and $ord_info['photosignin'] neq ''"/>
						alert('已经上传过照片');
						return false;
						</if>
						wx.chooseImage({
								count: 1, // 默认9
								sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
								sourceType: ['camera'], // 可以指定来源是相册还是相机，默认二者都有
								success: function (res) {
									$("#loading").show();
									var signtype=$("#signtype").val();			
									var localIds = res.localIds[0]; // 返回选定照片的本地ID列表，localId可以作为img标签的src属性显示图片
									wx.uploadImage({
											localId: localIds, // 需要上传的图片的本地ID，由chooseImage接口获得
											isShowProgressTips: 1, // 默认为1，显示进度提示
											success: function (res) {
												var serverId = res.serverId; // 返回图片的服务器端ID
												//window.location.href="/sign0?id="+id+"&signtype="+signtype+"&serverId="+serverId+"&uid="+$("#uid").val();
												$("#loading").show();
												$.ajax({
														type:'post',
														url:'/sign0',
														dataType:'json',
														data:{id:id,signtype:signtype,serverId:serverId,uid:$("#uid").val()},
														success:function (d){
															//alert('x');
															$("#photobox").attr('src','http://ozmy75p4d.bkt.clouddn.com/'+$("#uid").val()+'.jpg?imageView2/2/w/620/&r='+Math.random());
															setTimeout(function(){
																	$("#photobox").attr('src','http://ozmy75p4d.bkt.clouddn.com/'+$("#uid").val()+'.jpg?imageView2/2/w/620/&r='+Math.random());
															},800);
															$("#loading").hide();	
														}
													}
													);
											},fail: function (e) {
														alert('上传失败，请重试');
													  }

										});
									/*$("#loading").show();
									$.ajax({
											type:'post',
											url:'/sign0',
											dataType:'json',
											data:{id:id,signtype:signtype,localIds:localIds,uid:$("#uid").val()},
											success:function (d){
												$("#photobox").attr('src','http://ozmy75p4d.bkt.clouddn.com/'+$("#uid").val()+'.jpg?rr='+Math.random()+'&imageView2/2/w/620/&r='+Math.random());
												$("#loading").hide();	
											}
										}
										);*/
								}
							});
					}
				);
				
				}
			);
			
			
		</script>
</html>
